environment:
  MYSQL_DATABASE: node_mysql
  MYSQL_HOST: localhost
  MYSQL_USER: root
  MYSQL_PASSWORD: Password12!
  MYSQL_PATH: C:\Program Files\MySQL\MySQL Server 5.7

  matrix:
    - nodejs_version: "0.8"
    - nodejs_version: "0.10"
    - nodejs_version: "0.12"
    - nodejs_version: "1.8"
    - nodejs_version: "2.5"
    - nodejs_version: "3.3"
    - nodejs_version: "4.8"
    - nodejs_version: "5.12"
    - nodejs_version: "6.13"
    - nodejs_version: "7.10"
    - nodejs_version: "8.10"
    - nodejs_version: "9.8"

services:
  - mysql

cache:
  - node_modules

install:
  - ps: Install-Product node $env:nodejs_version
  - npm config set shrinkwrap false
  - if "%nodejs_version%" equ "0.8" npm rm --save-dev nyc
  - if "%nodejs_version%" equ "0.8" npm config set strict-ssl false
  - npm rm --save-dev eslint
  - if exist node_modules npm prune
  - if exist node_modules npm rebuild
  - npm install

build: off

before_test:
  - SET PATH=%MYSQL_PATH%\bin;%PATH%
  - mysqladmin --host=%MYSQL_HOST% --user=%MYSQL_USER% --password=%MYSQL_PASSWORD% create %MYSQL_DATABASE%

test_script:
  - mysql --version
  - node --version
  - npm --version
  - set npm_test_command=test
  - for /f %%l in ('npm -ps ls nyc') do set npm_test_command=test-ci
  - npm run %npm_test_command%

version: "{build}"
